<template>
  <div>
    <el-result icon="info" title="页面不存在" :sub-title="info">
      <template #extra>
        <template v-if="isInternal">
          <el-button @click="closeCurrentTab" type="primary" size="medium">关闭</el-button>
        </template>
        <template v-else>
          <el-button @click="backToMainPage" type="primary" size="medium">返回工作台</el-button>
        </template>
      </template>
    </el-result>
  </div>
</template>

<script setup>
import { onMounted,ref,computed } from "vue"
import { useRouter,useRoute } from "vue-router";

const Router = useRouter();
const Route = useRoute();

const backToMainPage = () => {
  Router.push("/")
}
const closeCurrentTab = () => {
  Router.closeTab();
}

const currentPage = computed(() => {
  return Route.query.url;
})
const isInternal = computed(() => {
  if (Route.matched.find(t => t.name == "internal")) {
    return true;
  }
  return false;
})
const info = computed(() => {
  return `页面${currentPage}不存在!`
})

</script>

<style lang='scss' scoped>
</style>